﻿@model ExpressQuiz.ViewModels.EditAnswerViewModel


<ul class="breadcrumb" style="margin-bottom: 5px;">
    <li>
       @Html.ActionLink("Quiz", "Edit", new { id = Model.QuizId })
    </li>
    <li>
        @Ajax.ActionLink("Question", "EditQuestion", "Quizzes", new { id = Model.QuestionId }, new AjaxOptions()
        {
            UpdateTargetId = "content",
            HttpMethod = "Get",
            InsertionMode = InsertionMode.Replace,
            OnSuccess = "applyValidation",
            OnFailure = "handleError",
           
        })
    </li>
    <li class="active">Answer</li>
</ul>



@using (Ajax.BeginForm("EditAnswer","Quizzes", new AjaxOptions()
{
    UpdateTargetId = "content",
    HttpMethod = "Post",
    InsertionMode = InsertionMode.Replace,
    OnBegin = "beforePost",

}))
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <h4>Answer</h4>
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        @Html.HiddenFor(model => model.Answer.AnswerId)

      

        <div class="form-group">
            @Html.LabelFor(model => model.Answer.Text, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Answer.Text, new { htmlAttributes = new { @class = "form-control pagedown", @rows = 5 } })
                @Html.ValidationMessageFor(model => model.Answer.Text, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Answer.Explanation, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Answer.Explanation, new { htmlAttributes = new { @class = "form-control", @rows = 5 } })
                @Html.ValidationMessageFor(model => model.Answer.Explanation, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Answer.IsCorrect, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                <div class="checkbox">
                    @Html.EditorFor(model => model.Answer.IsCorrect)
                    @Html.ValidationMessageFor(model => model.Answer.IsCorrect, "", new { @class = "text-danger" })
                </div>
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-11 col-md-1">
                <button type="submit" class="btn btn-primary has-spinner">
                    <span class="spinner"><i class="fa fa-refresh fa-spin"></i></span>
                    Save
                </button>
            </div>
        </div>
    </div>
}
